Repository navigation
Retry stale Durable Object binding verification reads after Worker upload - #880
Merged
cpojer merged 2 commits intoNov 19, 2026
Merged
Conversation
This was referenced Nov 21, 2026
Brooooooklyn
added a commit
that referenced
this pull request
Nov 25, 2026
#892) Fixes #891 for the version-list paths. The `triggers-failed` case in the issue is not changed here. ## Change Cloudflare's Worker version list can trail a write by minutes. The deploy now waits for it in the two places where the expected state is known: - Before the upload: while the list does not contain the active version that `deployments status` reported. This read had no retry. - After the upload: while the list is still identical to the pre-upload baseline, or is an older snapshot of it (it ends below the baseline and agrees with it on every shared version number). The existing retry stopped after 250 ms and 500 ms. - Both places: when `versions.list` fails because its two pages disagreed ("The Cloudflare Worker version history changed during inspection"). The runner now marks that failure as `version-history-changed`, and it is retried on the same schedule. Page 2 is read only above 10 versions, so this is the `inheritance-source-unavailable` shape in the second report on #891. After either wait, production is read again: before the upload, and before the candidate receipt is saved. If a rollback or another deploy changed it during the wait, the deploy stops with `deployment-changed` and saves no receipt, so the next deploy does not find a receipt with the wrong parent. Production is read again only after a wait for a lagging list, not after the quick retries of a failed read. If that read fails after the upload, the deploy stops with `status-failed` ("uploaded, but Cloudflare deployment status could not be verified before activation"); a handoff deploy keeps its verified receipt so the retry can use it. These waits use `STALE_VERSION_HISTORY_DELAYS_MS`: 250 ms doubling up to 30 s, 17 waits, about 5.5 minutes in total. Each wait checks `verifyUploader()`, and the first wait for a lagging list reports progress. The schedule can be overridden with the new `versionHistoryRetryDelaysMs` option. `STALE_VERSION_HISTORY_DELAYS_MS` is exported from the package entry. Why this length: in the runs in #891 a new version was still missing 52 s after creation and was listed within about 4.5 minutes. #880 and #868 retried for a second or less, which does not reach that. If maintainers want a shorter cap, change the constant. ## What does not change - A list that never catches up, or whose pages keep disagreeing, fails with `inheritance-source-unavailable`, before or after the upload. Nothing is uploaded when the pre-upload wait runs out, on handoff and direct deploys alike. (Before, a direct deploy could go on to pin the active secrets and upload.) - Any other mismatch (a concurrent version, a different history) still fails at once, with no wait. - Any other failed read (not stale, not page overlap) keeps its behavior: it fails at once before the upload and gets two quick retries after it. - A rollback to a version older than the list's page of 10 never appears in the list, so it does not wait. Before waiting, the active version's `number` is read with `versions.view`; the wait happens only when that number is not below the list's lowest number. If the number cannot be read (failed or thrown read, or no integer `number`; the API marks the field optional), it is read again on the next wait, and the deploy keeps waiting while it stays unreadable, since a version the list trails may not be readable yet either. - `void link` keeps a saved candidate receipt only when its parent is still the active version. - `stabilizeCloudflareVersionTriggers` is untouched. The logs in #891 do not show what its reads returned. ## Tests `packages/deploy-cloudflare/test/unit/version.test.ts`: - Pre-upload: active version present (no wait), list recovers after two stale reads, list never catches up (no upload), uploader changes during the wait. - Page overlap: retried and recovers, retried until the schedule runs out, and a different failure does not wait, before and after the upload. The runner test in `packages/void/test/unit/cf-version-runner.test.ts` checks the `version-history-changed` marker. - Post-upload: the existing stale-list cases now expect the full schedule; failed reads still expect two waits. An older snapshot waits like a stale list, and a list that names another version at a shared number still fails at once. A quick retry after a failed read adds no production read, and a wait that starts after a failed read still reports progress. - The default schedule is used, is between 5 and 6 minutes, and reports progress. - A rollback during the wait, before and after the upload: the deploy stops with `deployment-changed`, and `recordVerifiedCandidate` is never called. - An active version older than ten listed versions does not wait. A failed, thrown or unnumbered `versions.view` still waits the whole schedule. The new pre-upload tests and the changed stale-list case fail on `main` and pass here (5 failures without the change; measured before the page-overlap commit). ## Verified locally Run in a shell with no `CLOUDFLARE_*`, `CF_*` or wrangler variables (`env | grep -ciE 'cloudflare|^CF_|wrangler'` printed 0). The tests inject `runWrangler`, so no `cf` or `wrangler` process starts. - `vp test run packages/deploy-cloudflare/test/unit/version.test.ts`: 237 passed after the page-overlap commit (231 before) - After the page-overlap commit, `vp check`, `vp run check:types` (35/35) and `vp test run packages/deploy-cloudflare packages/deploy-core packages/void/test/unit` were re-run: 10069 passed, 17 failed. The 17 are `init.test.ts` (16) and `nitro.test.ts` (1), which also fail on the commit before this one in the same shell. - `vp check`: no warnings, lint errors or type errors - `vp run check:types`: 35/35 successful - `vp run test:all`: 92 of 93 tasks passed. The one failing task was `platform-api-integration-threads`, 12 tests, because Playwright's Chromium was not installed. After `playwright install chromium` the six failing files passed (204 tests). - No user-facing documentation changes: this is an internal retry window. --------- Co-authored-by: Christoph Nakazawa <cnakazawa@cloudflare.com> Co-authored-by: LongYinan <github@lyn.one> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes transient
Application custom Durable Object binding could not be verified.errors right afteruploadDeploymentWorkeruploads a Worker carrying custom Durable Object bindings.Summary
verifyManagedDurableObjectApplicationBindingsinplatform/packages/api/src/provisioning/durable-objects.tsto retry stale/emptyreadBindingsresults across bounded delays ([250, 500, 1_000]ms by default, matching the deployment readback retry pattern fromplatform upgrade: post-activation lineage check fails on a stale deployments read ("changed concurrently after activation") #868) before failing.0extra API calls when consistent) and allows overridingdelaysMsin tests.platform/packages/api/test/unit/deploy-durable-objects.test.tscovering immediate match, recovery after a stale/empty initial read, and failure when bindings never match.